package 线程.day2.demo2;

import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;

public class Test {
    public static void main(String[] args) {
        ScheduledExecutorService pool= Executors.newScheduledThreadPool(1);
        //1秒后，每间隔3秒执行一次
//        pool.scheduleAtFixedRate(new B(), 1, 3, TimeUnit.SECONDS);
        //三秒后执行一次
        pool.schedule(new B(),3, TimeUnit.SECONDS);
    }
}
